Ordering by hamming value

ABSTRACT

Apparatus and methods are disclosed for treating an input set of weightless binary tuples to order the Hamming values thereof. In the general case, the tuples are thermometer coded in a common direction (left or right) and thereafter an orthogonal thermocoding operation is applied in which orthogonal tuples, each taking a bit from a respective bit position of the thermocoded tuples, is subjected to a thermocoding operation in a common direction (up or down). At the completion of this operation the tuples represent the Hamming values of the input tuples, ranked in Hamming value order. The first thermocoding operation may be omitted where the input tuples are already in thermometer code. Also described is a scheme, which uses a tagging procedure to give the result in terms of the original weightless binary tuples, whereby the input pattern information is preserved.

This invention relates to apparatus and methods for ordering the Hammingvalues (as herein defined) of a set of weightless binary tuples, and tofilter apparatus utilising such apparatus and methods.

There are many applications where it is required to order the Hammingvalues of an input set of weightless binary tuples (as herein defined),for example to determine a median Hamming value for a set of weightlessbinary tuples (otherwise referred to as a “weightless median”) or eitheror both of the outlier Hamming values (otherwise referred to as“weightless outliers”). For example in a digital signal filteringoperation it is known to define a rolling window of defined extent whichoperates on a stream of digital samples, and to replace each value witha filtered value determined by a collective property of the values inthe window, typically a mean or a median value, such as a weightlessmedian. There are other instances where the outlier values may berequired, for example as a measure or metric of the homogeneity of thesamples in the window.

Other instances where ordering of the Hamming values and/ordetermination of a weightless median and/or the weightless outliers maybe required is in error detection and correction of digital code.

It may be required to determine a generic template from a set ofexemplars, and the weightless median of the exemplars could be used asthe generic template.

One possible way of extracting the weightless median would be to use atraditional algorithmic processor to evaluate the Hamming values andorder the tuples thereby to extract the weightless median. This may besuitable for some applications, but for operation in some harsh cosmicenvironments an asynchronous, memoryless, clockless implementation isdesirable in order to reduce cosmic induced bit errors.

Definitions

Weightless binary: This means that each active bit has unit weight—just“1” as opposed to “natural” weighted binary which has positionalweightings of 1, 2, 4, 8 . . . .

Weightless binary tuple: This defines a collection of weightless bits inwhich the order is irrelevant. For example, [0 0 1 1], [1 1 0 0] and [10 1 0] each have the same significance.

Thermometer code (alternatively referred to as thermocode): This is aform of weightless binary in which the 1's and 0's within the tuple aregrouped together. For example, [1 0 1 0 1] in thermocode is [1 1 1 0 0]or, alternatively, [0 0 1 1 1].

Hamming value (Hv): This is the number of 1's within a tuple. Forexample [1 0 1 0 1 1] has a Hamming value of 4.

Traditional median: Given an odd number of values the median is thecentral value of the ordered set. For example given [3 1 2 4 7], theyare ordered as [1 2 3 4 7]. The central value, the median, is 3.

Outliers: Given a set of values, the outliers are the extreme values ofthe ordered set. For example given [27 3 1 2 4 7], they are ordered as[1 2 3 4 7 27]. The outliers are 1 and 27.

Weightless median: Given an odd number of weightless tuples theweightless median is the Hamming value of the central tuple of the setordered by Hamming value. If there is an even number of weightlesstuples the weightless median may be taken to be either of the values toeither side of the non-existent median and this is still referred toherein as a weightless median. Thus for an even number of weightlesstuples the weightless median may not be a unique value. Alternatively,the set may be made up to an odd number by duplication of one of thetuples. The resultant weightless median is likewise also referred to asa weightless median.

Weightless outlier: Given any number of weightless tuples the weightlessoutliers are the Hamming values of the extreme tuples of the set orderedby Hamming value.

For example, given 5 weightless tuples, t1 to t5; $\begin{matrix}{{{t1} = \begin{bmatrix}0 & 0 & 1 & 0 & 0 & 0\end{bmatrix}},} & {{Hv} = {1\quad{lowest}}} \\{{{t2} = \begin{bmatrix}1 & 0 & 0 & 1 & 0 & 0\end{bmatrix}},} & {{Hv} = 2} \\{{{t3} = \begin{bmatrix}0 & 0 & 1 & 0 & 0 & 0\end{bmatrix}},} & {{Hv} = {1\quad\left( {{equal}\quad{lowest}} \right)}} \\{{{t4} = \begin{bmatrix}0 & 0 & 1 & 1 & 0 & 1\end{bmatrix}},} & {{Hv} = {3\quad{highest}}} \\{{{t5} = \begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix}},} & {{Hv} = 2}\end{matrix}$

Ordering these tuples according to their Hamming value gives;$\begin{matrix}{{{t4} = \begin{bmatrix}0 & 0 & 1 & 1 & 0 & 1\end{bmatrix}},} & {{Hv} = {3\quad{Highest}\quad{outlier}}} \\{{{t2} = \begin{bmatrix}1 & 0 & 0 & 1 & 0 & 0\end{bmatrix}},} & {{Hv} = 2} \\{{{t5} = \begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix}},} & {{Hv} = {2\quad{Weightless}\quad{median}}} \\{{{t3} = \begin{bmatrix}0 & 0 & 1 & 0 & 0 & 0\end{bmatrix}},} & {{{Hv} = 1}\quad} \\{{{t1} = \begin{bmatrix}0 & 0 & 1 & 0 & 0 & 0\end{bmatrix}},} & {{Hv} = {1\quad{Lowest}\quad{outlier}}}\end{matrix}$

Hence the Hamming value of t5, or t2, is the weightless median but givenin thermometer code. The selection of the Hamming value of t5 or t2 asthe weightless median is unimportant.

SUMMARY OF THE INVENTION

According to one aspect of this invention there is provided a method oftreating an input set of weightless binary thermometer code tuples eachwith the set bits grouped at a given end of each tuple, to order theHamming values of said weightless binary thermometer code tuples, whichcomprises performing an orthogonal thermocoding operation equal orcorresponding to one in which:

-   -   (i) the set of weightless binary thermometer code tuples is        assembled into a matrix with said weightless binary tuples        stacked in a given direction (e.g. vertically) to define a set        of orthogonal tuples each extending in said given direction        (e.g. vertically) and each made up of a bit taken from each of        said weightless binary tuples at a respective bit position, and    -   (ii) each of said orthogonal tuples is subjected to a        thermocoding step to group the set bits at a given end of each        tuple,

thereby to order the Hamming values of said weightless binarythermometer code tuples.

The orthogonal thermocoding operation may be performed in variousdifferent ways as to be described below and it is not essential for theweightless binary thermometer code tuples actually to be assembled intoa matrix provided that an analogous thermocoding operation is achieved.Surprisingly, we have found that performing an orthogonal thermocodingoperation on an input set of weightless binary thermometer code tuplesorders the Hamming values of the tuples without altering the Hammingvalues.

If the input data is not already in the form of weightless binarythermometer code tuples then there may be appropriate encoding anddecoding upstream and downstream of the orthogonal thermocodingoperation to convert input data (e.g. weighted binary, weightless binaryetc.) into thermometer code and to return it to the desired coding.

Accordingly, in another aspect, where the input is in the form ofweightless binary tuples, this invention provides a method of treatingan input set of weightless binary tuples to order the Hamming values ofsaid weightless binary tuples, which comprises performing a thermocodingoperation on each of said weightless binary tuples to group the set bitsat a given end of each tuple to provide a set of weightless binarythermometer code tuples, and thereafter performing an orthogonalthermocoding operation corresponding to one in which:

-   -   (i) the set of weightless binary thermometer code tuples is        assembled into a matrix with said weightless binary tuples        stacked in a given direction (e.g. vertically) to define a set        of orthogonal tuples each extending in said given direction        (e.g. vertically) and each made up of a bit taken from each of        said weightless binary tuples at a respective bit position, and    -   (ii) each of said orthogonal tuples is subjected to a        thermocoding step to group the set bits at a given end of each        tuple,    -   thereby to order the Hamming values of said weightless binary        tuples.

Having ordered the set of Hamming values one or more selected Hammingvalues of the set may be determined. For example, where the input setcomprises an odd number of tuples a weightless median of said set may bedetermined by identifying the central value of the ordered set. Wherethe input set comprises an even number (2n) of tuples, a median may bedetermined by identifying in the ordered set a value corresponding tothe n^(th) or the n+1^(th) value. Alternatively, where the input setcomprises an even number of tuples, a further tuple may be introducedinto the set (for example by duplicating one of the other tuples of theinput set) to make an odd number of tuples before performing theorthogonal thermocoding operation.

At least one weightless outlier value may be determined by identifyingat least one of the first and last of said ordered Hamming values.

Where the input bit pattern corresponding to one of the ordered Hammingvalues is required, in one embodiment having ordered the Hamming valuesof said weightless binary tuples, and after said orthogonal thermocodingoperation, the bit pattern of at least one of said tuples correspondingto a given ranking is compared to the bit patterns of the tuples beforesaid orthogonal thermocoding operation to identify an or the equivalenttuple thereto, and the location of said equivalent tuple is used todetermine a corresponding input tuple, thereby to identify or presentthe input tuple with said given ranking.

The invention extends to a method of applying a filtering operation to atwo- or—higher dimensional array of tuples in which the method asdefined above is performed on a set of values in a pre-determined windowin said array in a filtering step and at least a selected one of theordered Hamming values is used as the filtered result, with the windowbeing incremented relative to the array to provide a series of filteredresults.

In one instance, a median Hamming value is taken as the filtered result.

The filtering operation may be applied to a two-dimensional array oftuples, for example representing a two-dimensional image. Alternatively,the filtering operation may be applied to a three-dimensional array oftuples, representing a three-dimensional volume of air traffic space.

The invention also extends to filter apparatus for applying thefiltering operation described above.

In another aspect, this invention provides apparatus for treating aninput set of weightless binary thermometer code tuples with the set bitsgrouped at a given end of each tuple, thereby to order the Hamming valueof said weightless binary thermometer code tuples, said apparatuscomprising:

-   -   transformation means for performing an orthogonal thermocoding        operation corresponding to one in which:    -   (i) the set of weightless binary thermometer code tuples is        assembled into a matrix with said weightless binary tuples        stacked in a given direction (e.g. vertically) to define a set        of orthogonal tuples each extending in said given direction        (e.g. vertically) and each made up of a bit taken from each of        said weightless binary tuples at a respective bit position, and    -   (ii) each of said orthogonal tuples is subjected to a        thermocoding step to group the set bits at a given end of each        tuple,    -   thereby to order the Hamming values of said weightless binary        thermometer code tuples.

The above apparatus is intended to receive an input set of weightlessbinary tuples in thermometer code.

In another aspect, intended for treating an input set of weightlessbinary tuples not already in thermometer code, there is providedapparatus for treating an input set of weightless binary tuples, whichcomprises:

-   -   first stage thermocode converter means for converting each of        said weightless binary tuples into a weightless binary        thermometer code tuple to provide a set thereof, and    -   transformation means for performing an orthogonal thermocoding        operation corresponding to one in which:    -   (i) the set of weightless binary thermometer code tuples is        assembled into a matrix with said weightless binary tuples        stacked in a given direction (e.g. vertically) to define a set        of orthogonal tuples each extending in said given direction        (e.g. vertically) and each made up of a bit taken from each of        said weightless binary tuples at a respective given bit        position, and    -   (ii) each of said orthogonal tuples is subjected to a        thermocoding step to group the set bits at a given end of each        tuple,    -   thereby to order the Hamming values of said weightless binary        thermometer code tuples.

Preferably, the first stage thermocode converter means comprisesrespective thermocode converter means for each of said weightless binarytuples making up the input set.

The transformation means preferably includes orthogonal tuple definingmeans for defining a set of orthogonal tuples, each said orthogonaltuple being made up of bits taken from a respective bit position of saidweightless binary thermometer code tuples, and respective thermocodeconverter means for thermocoding each of said orthogonal tuples. Theorthogonal tuple defining means typically comprises a mapping ofinterconnects mapping the bits of the thermometer code tuples to theappropriate thermocode converter means.

Preferably, said apparatus includes means for analysing a matrix made upof said thermocoded orthogonal tuples to determine the or a centraltuple orthogonal to said orthogonal tuples, said central tuplerepresenting to the median Hamming value of said weightless binarythermometer code tuples. Likewise the apparatus may include means fordetermining the first and the last of the tuples orthogonal to saidorthogonal tuples, representing at least one outlier.

The thermocode means may take many forms. For example it may comprise anasynchronous thermometer coding means using a modular structure.Alternatively, at least one of the thermocode means may comprise apipelined synchronous thermocode means. Examples of such devices aregiven in our earlier published International Patent Application No. WO99/33184. Yet further, the thermocode converter means may comprise athermometer code converter which operates on an input stream ofweightless binary data, as described in our copending application ofeven date Patent Application No. PCT/GB03/______(our reference XA1619).

In another aspect, this invention provides apparatus for treating aninput set of weightless binary thermometer code tuples each with the setbits grouped at a given end of the tuple, said apparatus comprising:

-   -   respective thermocode converter means for each bit position of        the input tuples, each thermocode converter means receiving a        bit from each of the weightless binary thermometer code tuples        and performing a thermometer coding operation on said bits,        collectively to apply an orthogonal coding operation on said        weightless binary tuple code tuples, to provide a set of        orthogonally thermocoded tuples, which when assembled        side-by-side in a matrix make up an ordered set of tuples        representing the Hamming values of said weightless binary        thermometer code tuples.

In yet another aspect this invention provides apparatus for treating aninput set of weightless binary tuples which comprises:—

-   -   respective first stage thermocode converter means for converting        each of said weightless binary tuples into a weightless binary        thermometer code tuple;    -   respective second stage thermocode converter means for each bit        position of the input tuples, each thermocode converter means        receiving a bit from each of the weightless binary thermometer        code tuples and performing a thermometer coding operation on        said bits, collectively to apply an orthogonal coding operation        on said weightless binary tuple code tuples, to provide a set of        orthogonally thermocoded tuples, which when assembled in a        matrix make up an ordered set of tuples representing the Hamming        value of said weightless binary thermometer code tuples.

Whilst the invention has been described above, it extends to anyinventive combination of the features set out above or in the followingdescription.

The invention may be performed in various ways, and an embodimentthereof will now be described by way of example-only, reference beingmade to the accompanying drawings, in which:—

FIG. 1 is a schematic view of a first embodiment of a weightless medianevaluator in accordance with this invention;

FIG. 2 is an example of a known thermometer code converter of modularform for use as a component in the embodiment of FIG. 1;

FIG. 3 is a schematic diagram of a weightless median filter inaccordance with the invention and using a weightless median evaluator ofthe form shown in FIG. 1;

FIG. 4 is a chart showing the weightless binary inputs, the results of afirst stage horizontal thermocode conversion and the median filterresult for a series of samples 8 bits wide and with a window size ofthree successive samples;

FIG. 5 is a reference image (512×512 pixel 8 bit weighted grey-scale);

FIG. 6 is the image of FIG. 5 but with 10% added salt-and-pepper noise;

FIG. 7 is the image of FIG. 5 using the weightless median filter, and

FIG. 8 is a graph showing the trend in filtration improvement as thenoise density is increased.

FIG. 9 is a top level block diagram of a second embodiment in accordancewith this invention, which orders a set of weightless binary tuplesaccording to their Hamming value, and

FIGS. 10 to 12 are logic diagrams of Boolean logic implementations ofthe tag compare modules and the pattern select module of the secondembodiment.

The embodiments disclosed herein describe a new mechanism for Hammingvalue ordering and weightless median extraction from a set of weightlessbinary tuples. Obviously the input data needs to be converted intoweightless binary if it is not already in this form. Initially the bitmanipulation steps performed to achieve Hamming value ordering andweightless median extraction will be described with reference to thefive weightless tuples t1 to t5, each 6 bits wide, described in theintroduction, on pages 3 and 4 of the text as filed. Having describedthe bit manipulation steps required apparatus for implementing theinvention will be described in further detail.

Given the earlier example of, $\begin{matrix}{{t1} = \begin{bmatrix}{0\quad} & 0 & {\quad 1} & {\quad 0} & {\quad 0\quad} & 0\end{bmatrix}} \\{{t2} = \begin{bmatrix}{1\quad} & {0\quad} & 0 & {\quad 1} & {\quad 0} & {\quad 0}\end{bmatrix}} \\{{t3} = \begin{bmatrix}{0\quad} & {0\quad} & 1 & {\quad 0\quad} & 0 & {\quad 0}\end{bmatrix}} \\{{t4} = \begin{bmatrix}{0\quad} & {0\quad} & {1\quad} & {1\quad} & 0 & {\quad 1}\end{bmatrix}} \\{{t5} = \begin{bmatrix}{1\quad} & {1\quad} & {0\quad} & {0\quad} & {0\quad} & 0\end{bmatrix}} \\\begin{matrix}{\quad{c1}} & {c2} & {c3} & {c4} & {c5} & {\quad{c6}}\end{matrix}\end{matrix}$t1 to t5 are the input tuples, and columns c1 to c6 are imposedorthogonal thermocoding is now performed; in a first stage, each tuplet1 to t5 is thermocoded. So the rows t1 to t5 are thermocoded in eitherdirection—to the left or the right. This gives, thermocoding to theleft, $\begin{matrix}\begin{bmatrix}1 & 0 & 0 & 0 & 0 & 0\end{bmatrix} \\\begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix} \\\begin{bmatrix}1 & 0 & 0 & 0 & 0 & 0\end{bmatrix} \\\begin{bmatrix}1 & 1 & 1 & 0 & 0 & 0\end{bmatrix} \\\begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix}\end{matrix}$Then thermocoding is performed along the columns, either upwards ordownwards. This gives, thermocoding upwards, the desired result:—$\begin{matrix}{\begin{bmatrix}1 & 1 & 1 & 0 & 0 & 0\end{bmatrix}\quad} & {{Highest}\quad{weightless}\quad{outlier}} \\\begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix} & \quad \\\begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix} & {{Weightless}\quad{median}} \\\begin{bmatrix}1 & 0 & 0 & 0 & 0 & 0\end{bmatrix} & \quad \\\begin{bmatrix}1 & 0 & 0 & 0 & 0 & 0\end{bmatrix} & {{Lowest}\quad{weightless}\quad{outlier}}\end{matrix}$The orthogonal thermocoding process yields the weightless median inthermocode as the central value i.e. row t5.

This process may be visualised as assembling the input tuples into amatrix, then performing a first thermocoding step in which each tuple isthermocoded along the rows to the left, and a second thermocoding stepin which the columns are thermocoded upwards. In this visualisation thetuples could be stacked vertically or horizontally, provided the firstthermocoding is done in one sense along the direction of the tuples. Inpractice of course there may be no matrix as such because the tuples maybe supplied to individual first stage thermocoders whose outputs arehardwired in a preset mapping to the inputs of individual second stagethermocoders, with selected outputs of the second stage thermocodershardwired to an output interface.

It should be noted that, in the described embodiment, the two stageorthogonal process must be performed in order, namely a horizontaloperation along the direction of the tuple and then a vertical operationorthogonal thereto.

Naturally if the input data is already thermocoded it is only requiredto perform the vertical thermocoding to obtain the weightless median. Itwill be appreciated that this provides a unique weightless median onlyif there is an odd number of tuples. When presented with an even set oftuples, one of the tuples (for example, the first) is duplicated toobtain an odd set. Alternatively the tuple one above or below thenon-existent median may be taken as an approximation; such anapproximation obtained in either manner is also referred to herein forconvenience as a weightless median.

The above method is technology independent; it may be implementedelectronically, optically, magnetically etc.

Referring now to FIG. 1, this shows a block diagram for a weightlessmedian evaluator which also determines the weightless outliers.

Referring to the Figure, the weightless median evaluator 10 is designedto receive and evaluate the median of 5, 5-bit wide weightless binarytuples. The evaluator 10 comprises a first layer of thermocoders 12designed to thermocode to the left, i.e. to group the set bits at theleft hand end of the thermocode output. The inputs to each first layerthermocoder are here shown above the thermocoder box, whilst thethermocode output is shown within the box.

An orthogonal set of five second layer thermocoders 14 receives asinputs the outputs of the first layer of thermocoders 12. Each secondlayer thermocoder 14 takes the output bits from a respective bitposition of the thermocoded output of the first layer; thus the leftmostsecond layer thermocoder 14 takes the leftmost bits of the thermocodeoutput of the first layer of thermocoders, the rightmost second layerthermocoder 14 takes the rightmost bits of the thermocoded output of thefirst layer and so on. Thus if the five input tuples (0 0 1 1 0), (0 1 01 1), (0 0 0 1 0), (1 1 0 1 1) and (0 0 0 1 0) are visualised as amatrix made up of these tuples stacked vertically, thus $\begin{matrix}0 & 0 & 1 & 1 & 0 \\0 & 1 & 0 & 1 & 1 \\0 & 0 & 0 & 1 & 0 \\1 & 1 & 0 & 1 & 1 \\0 & 0 & 0 & 1 & 0\end{matrix}$the first layer of thermocoders thermocode the rows to the left, toprovide the following array: $\begin{matrix}1 & 1 & 0 & 0 & 0 \\1 & 1 & 1 & 0 & 0 \\1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 \\1 & 0 & 0 & 0 & 0\end{matrix}$the orthogonal thermocoding operation effects the transformation to thefollowing: $\begin{matrix}1 & 1 & 1 & 1 & 0 \\1 & 1 & 1 & 0 & 0 \\1 & 1 & 0 & 0 & 0 \\1 & 0 & 0 & 0 & 0 \\1 & 0 & 0 & 0 & 0\end{matrix}$

Referring back to FIG. 1, the central output bit of each second layerthermocoder is output as a tuple at 16 to represent the weightlessmedian. Likewise the first and last bits from each of the second layerthermocoders may be output at 18 and 20 respectively to indicate thehighest and lowest outliers.

FIG. 2 is a diagram representing a suitable form of asynchronous modularthermometer coder 22 which could be used to implement the arrangement ofFIG. 1. Five such decoders would be required in the first layer and fivein the second layer. The thermometer code converter of FIG. 2 has sixinputs 24 but the sixth input could be set at zero in each case. Thedecoder of FIG. 2 is described in more detail in International PublishedApplication WO 99/33184 but briefly is made up of a series ofinterconnected modules or “bit manipulation cells” 26 each made up of anAND gate 28 and an OR gate 30 interconnected as shown in the Figure. Itis emphasised that this is just one form of thermometer code converterand many others may be used.

The orthogonal median evaluator of FIG. 1 may be used to form aweightless median filter as shown in FIG. 3. In the arrangement of FIG.3 a stream of n-bit weightless tuples is supplied to a chain of threesample holding registers 32 through which the samples are clocked underthe control of a clock 34. The chain is tapped and three samples areprovided to a weightless median evaluator 36. The sample holdingregisters 32 effectively define a rolling three sample window whichsupplies three weightless samples at each clock cycle. Here theweightless evaluator 36 has a first layer of three thermocode generators(one for each sample) (not shown) with each first layer thermocodegenerator being n bits wide. The second layer will have n thermocodegenerators (not shown) each three bits wide.

FIG. 4 shows a series of 14 input samples (labelled “Weightless BinaryInput”), the result of the first thermocode conversion (labelled“Horizontal Thermocode”) and the median filter result output defined bythe tuple made up from the output bits at the centre bit position ofeach of the n second level thermocode generators. In particular it willbe noted that the potentially suspect sample 5 has been attenuated inthe filtered output.

In another example, a MATLAB® simulation of a two-dimensional,three-by-three sample space (defining a nine-element “window”) operatedon the same principles as the block diagram shown in FIG. 3. Thenine-element window is set up in known fashion using line delays andsample holding registers controlled by a clock signal to make availablethe current nine samples to a weightless median evaluator. In thisexample, a test image consisting of a 512×512 pixel 8-bit weightedgrey-scale image was used as a reference. The 8-bit binary code convertsinto 255 bits of thermometer code. Quantisation noise was excluded fromthe simulation. As before, the number of thermocoders in the first stageis dictated by the number of samples in the window (i.e. nine) with thenumber of second stage orthogonal thermometer code converterscorresponding to the digital width of the samples.

FIG. 5 is a representation of the image used in this example, before theaddition of noise. A noise density of 10% was used to add impulsivesalt-and-pepper noise to the reference image to form a suitable imagefor processing using the weightless median filter.

FIG. 6 shows the image with the noise added. The mean square errorintroduced by the noise was 2121 and the peak signal-to-noise ratio was14.9 dB.

The filtered image is shown in FIG. 7. The mean square error has beenreduced by the filtration to 71 and the peak signal-to-noise ratio hasincreased to 29.6 dB.

FIG. 8 shows the trend in filtration improvement as the noise densitiesincrease.

The embodiment of FIG. 1 provides an ordered set of tuples which arethermocoded versions of the input tuples rather than the tuplesthemselves. Whilst this is useful in many applications such as themedian filter illustrated in FIG. 3, there are other applications inwhich it is desirable to output, say, the actual tuple having the medianvalue in a set, rather than a thermocoded version thereof.

Accordingly, the further embodiment illustrated and described withreference to FIGS. 9 to 12 receives a set of weightless binary inputtuples and uses a technique similar to the above technique of orthogonalthermocoding to order thermocoded versions of the input tuples, but witha modification to give the result in terms of the original weightlessbinary tuples whereby the input pattern information is preserved.

FIG. 9 is a top level block diagram of this further embodiment, whichwill be described in conjunction with a worked example. The inputpattern, which in this example is three input tuples T1 to T3, e.g.$\begin{matrix}{T1} & \quad & 0 & 1 & 0 & 1 \\{T2} & \quad & 0 & 1 & 0 & 0 \\{T3} & \quad & 1 & 1 & 0 & {1,}\end{matrix}$is applied to an input device 40. The tuples from the input device passto a horizontal thermocoder 42 where the tuples are horizontallythermocoded (e.g. to the left) to yield: $\begin{matrix}{HT1} & \quad & 1 & 1 & 0 & 0 \\{HT2} & \quad & 1 & 0 & 0 & 0 \\{HT3} & \quad & 1 & 1 & 1 & {0,}\end{matrix}$where HT1 denotes a tuple obtained by horizontally thermocoding T1 etc.

The bits from the horizontal thermocoder 42 are then passed to avertical thermocoder 44 where the bits in vertical tuples, correspondingto the columns of an array obtained by vertically stacking the tuplesHT1, HT2, HT3, are vertically thermocoded (e.g. vertically downwards) togive: $\begin{matrix}{{VHT}\quad 1} & 1 & 0 & 0 & 0 \\{{VHT}\quad 2} & 1 & 1 & 0 & 0 \\{{VHT}\quad 3} & 1 & 1 & 1 & 0\end{matrix},$where the prefix “V” denotes a vertical thermocode operation andcorrespondingly the prefix “VH” denotes an orthogonal thermocodeoperation. At this stage, the tuples have been rearranged ororthogonally thermocoded as in the embodiment of FIG. 1. However in thisfurther embodiment of FIG. 9, the values of the orthogonally thermocodedtuples VHT1 to VHT3 (i.e. 1 0 0 0), (1 1 0 0), (1 1 1 0) are used as“tags” which are compared logically with HT1 to HT3 to determine therespective mappings, with the resulting comparison being used to selectthe corresponding input tuple T1 to T3.

In the above example, the vertical thermocoding has been done downwardswhich mean that VHT2 corresponds to the weightless median and VHT1 andVHT3 correspond to the lowest and highest outliers respectively. Todetermine the lowest outlier, VHT1's tag is 1 0 0 0 in this example.This tag (1 0 0 0) is compared with HT1 to HT3 and here corresponds toHT2, and HT2 selects T2, i.e. (0 1 0 0) Similarly for the median, VHT2'stag is (1 1 0 0) which corresponds to HT1 which selects T1 i.e. (0 1 01). For the highest outlier VHT3's tag is (1 1 1 0) which corresponds toHT3 which selects T3 i.e. (1 1 0 1).

To implement this, the results of the horizontal thermocoding by thehorizontal thermocoder 42 and the results of the vertical thermocodingat the vertical thermocoder 44 pass to a tag compare module 46 whichperforms the tag comparison described above and outputs to a patternselect module 48 a select signal which selects from the originalnon-thermocoded input pattern the lower outlier (referred to as new T1),the median having the median Hamming value (referred to as New T2) andthe highest outlier (referred to as New T3). Although in this example(and in the circuits of FIGS. 10 to 12) only three input and threeoutput tuples are provided, it will be immediately apparent to oneskilled in the art that the technique may easily be expanded to processlarger numbers of input tuples and to provide an output in which thetuples are ordered according to their Hamming values, with the originalpatterns in the tuples preserved.

In this illustrated example the output from the pattern select module 48is thus:— $\begin{matrix}{{{New}\quad T\quad 1} = \begin{matrix}0 & 1 & 0 & 0 & \left( {{outlier}\quad{with}\quad{lower}\quad{Hamming}\quad{value}} \right)\end{matrix}} \\{{{New}\quad T\quad 2} = \begin{matrix}0 & 1 & 0 & 1 & ({median})\end{matrix}} \\{{{New}\quad T\quad 3} = \begin{matrix}1 & 1 & 0 & 1 & \left( {{outlier}\quad{with}\quad{highest}\quad{Hamming}\quad{value}} \right)\end{matrix}}\end{matrix},$although the technique could be pruned to generate one, or more, or allthe outliers or medians.

FIGS. 10 to 12 are logic diagrams of Boolean logical implementations ofthe tag compare module 46 and the pattern select module 48 of FIG. 9. Inthis example three operations are performed in parallel using threegenerally similar arrangements to determine the lowest outlier tuple T1,the weightless median T2, and the highest outlier tuple T3, using thededicated logic circuits in FIGS. 10, 11 and 12 respectively. Each logiccircuit receives the output bits from the entire result of thethermocoding by the horizontal thermocoder 42, and a respective one ofthe rows of the bits from the result of the thermocoding by the verticalthermocoder 44.

Referring initially to FIG. 10, at the foot thereof is shown thecoordinate system for identifying the bits in the tuple input pattern50, the horizontal thermocoding output pattern 52, and the verticalthermocoding output pattern 54, and this coordinate system is used inFIGS. 11 and 12 also.

Each tag compare module 46 in the three circuits comprises three submodules 49, 49″ and 49′″, each of which comprises four 2-input EXNORgates 56, the outputs of which are passed to a respective 4-input ANDgate 58′, 58″ and 58′″. The outputs from the AND gates 58′ to 58′″ areprioritised by a two input AND gate 60 with the input from the first submodule 49′ inverted, and a three input AND gate 62 with the inputs fromthe sub modules 41′ and 49″ inverted, such that a high output from thefirst AND gate 58′ ensures that the outputs from the second and thirdAND gates 58″ and 58′″ are inhibited, and likewise a high output fromthe second AND gate 58″ inhibits the output from the third AND gate58′″.

Consequently the output of each tag compare module 46 is a single ‘1’ onone of the three output lines 64′ to 64′″ thereof, which is passed tothe associated pattern select module 48 to select a corresponding one ofthe input tuples. Each pattern select module 48 is made up of a 4×3array of AND gates 66 each of which receives a corresponding bit fromthe input pattern 50 (i.e. the three 4-bit tuples T₁ to T₃ in thisexample), with the input lines 64′, 64″ and 64′″ connected to respectiverows of the AND gates. The outputs from each of the columns of the ANDgates are ORed together by respective OR gates 68, such that a logic 1on one of the lines 64′, 64″ and 64′″ selects that row which ispresented on the output of the OR gates 68.

The tag compare module 46 of FIG. 10 determines the lowest outlier. Thefirst sub module 49′ compares bitwise the bits of the first row of theoutput of the vertical thermocoder (i.e. VHT1) with the bits of thefirst row of the output of the horizontal thermocoder (i.e. HT1). Thesecond sub module 49″ compares VHT1 with HT2, and the third submodule49′″ compares VHT2 with HT3.

The tag compare modules 46 of FIGS. 10 and 11 are generally similarexcept in FIG. 10, the submodules 49′, 49″, 49′″ compare the second rowof the output of the vertical thermocoder i.e. VHT2 with HT1, HT2 andHT3 respectively and in FIG. 12 the submodules 49′, 49″, 49′″ comparethe third row of the vertical thermocoder, i.e. VHT3 with HT1, HT2 andHT3 respectively.

Thus the outputs from the circuits of FIGS. 10 to 12 may be reassembledto provide a bit pattern corresponding to the input bit patternreordered according to the Hamming values of the input tuples.

This embodiment deals automatically with cases where several or all thebit patterns are the same. It will be appreciated that the architectureis readily extensible in terms of the numbers of tuples and bit width.The number of tuples does not have to be odd. The implementation isentirely asynchronous.

This technique preserves the original bit patterns and their Hammingvalue ratings (ordering) but does not always preserve their order. Forexample $\begin{matrix}1 & 0 & 1 & 1 \\0 & 1 & 0 & 1 \\1 & 0 & 1 & 0 \\0 & 1 & 0 & 0\end{matrix}\quad{may}\quad{yield}\quad\begin{matrix}1 & 0 & 1 & 1 \\1 & 0 & 1 & 0 \\0 & 1 & 0 & 1 \\0 & 1 & 0 & 0\end{matrix}$

1. A method of treating an input set of weightless binary thermometercode tuples (t1 to t5) each with the set bits grouped at a given end ofeach tuple, to order the Hamming values of said weightless binarythermometer code tuples, which comprises performing an orthogonalthermocoding operation equal or corresponding to one in which: (i) theset of weightless binary thermometer code tuples is assembled into amatrix with said weightless binary tuples stacked in a given direction(e.g. vertically) to define a set of orthogonal tuples (c1 to c6) eachextending in said given direction (e.g. vertically) and each made up ofa bit taken from each of said weightless binary tuples at a respectivebit position, and (ii) each of said orthogonal tuples (c1 to c6) issubjected to a thermocoding step to group the set bits at a given end ofeach tuple, thereby to order the Hamming values of said weightlessbinary thermometer code tuples.
 2. A method of treating an input set ofweightless binary tuples (t1 to t5) to order the Hamming values of saidweightless binary tuples, which comprises performing a thermocodingoperation on each of said weightless binary tuples (t1 to t5) to groupthe set bits at a given end of each tuple to provide a set of weightlessbinary thermometer code tuples, and thereafter performing an orthogonalthermocoding operation corresponding to one in which: (i) the set ofweightless binary thermometer code tuples is assembled into a matrixwith said weightless binary tuples stacked in a given direction (e.g.vertically) to define a set of orthogonal tuples (c1 to c6) eachextending in said given direction (e.g. vertically) and each made up ofa bit taken from each of said weightless binary tuples at a respectivebit position, and (ii) each of said orthogonal tuples (c1 to c6) issubjected to a thermocoding step to group the set bits at a given end ofeach tuple, thereby to order the Hamming values of said weightlessbinary tuples.
 3. A method according to claim 1, wherein the input set(t1 to t5) comprises an odd number of tuples, and which furthercomprises determining the median of said set by identifying the centralvalue of said ordered Hamming values.
 4. A method according to claim 1wherein the input set comprises an even number (2n) of tuples, and whichfurther comprises determining a median by identifying in said orderedset of Hamming value a value corresponding to one of the n^(th) or the(n+1)^(th) values.
 5. A method according to claim 1 wherein the inputset comprises an even number (2n) of tuples, and which further comprisesdetermining a median of said set by introducing a further tuple intosaid set before performing said orthogonal thermocoding operation sothat the set comprises an odd number of tuples.
 6. A method according toclaim 5, wherein said further tuple is produced by duplicating one ofthe other tuples in said input set.
 7. A method according to claim 1,which further comprise determining at least one weightless outlier valueby determining at least one of the first and last of said orderedHamming values.
 8. A method of applying a filtering operation to a two-or higher-dimensional array of tuples, which comprises: performing themethod of any of the preceding claims on a set of values in apredetermined window in said array in a filtering step, using at least aselected one of said ordered Hamming values as the filtered result ofsaid filtering step, and incrementing said window relative to saidarray, to provide a series of filtered results.
 9. A method according toclaim 8, wherein for each filtering step, a median Hamming value istaken as the filtered result.
 10. A method according to claim 8, whereinsaid array of tuples is two-dimensional and represents a two-dimensionalimage.
 11. A method according to claim 8, wherein said array of tuplesis three-dimensional and represents a three dimensional volume.
 12. Amethod according to claim 1 wherein, having ordered the Hamming valuesof said weightless binary tuples, and after said orthogonal thermocodingoperation, the bit pattern of at least one of said tuples correspondingto a given ranking is compared to the bit patterns of the tuples beforesaid orthogonal thermocoding operation to identify an or the equivalenttuple thereto, and the location of said equivalent tuple is used todetermine a corresponding input tuple, thereby to identify or presentthe input tuple with said given ranking.
 13. A method according to claim12, wherein the bit patterns of all of the tuples after said orthogonalcoding operation are compared to the bit patterns of the tuples beforesaid orthogonal thermocoding operation thereby to identify equivalentsto each thereof and thereby to identify a ranking of each of said inputtuples.
 14. A method according to claim 13, wherein said comparison isdone asynchronously and in parallel.
 15. A method of filtering a streamof weightless binary tuples comprises selecting from said stream aplurality of sample tuples and applying to said sample tuples a methodaccording to claim 1, to order the Hamming values of said tuples andselecting at least one of the Hamming values according to its order andouputting said selected Hamming value as the filtered output.
 16. Amethod according to claim 15, which comprises selecting a median Hammingvalue for the filtered output.
 17. Apparatus for treating an input setof weightless binary thermometer code tuples (t1 to t5) with the setbits grouped at a given end of each tuple, thereby to order the Hammingvalue of said weightless binary thermometer code tuples, said apparatuscomprising: transformation means (14) for performing an orthogonalthermocoding operation corresponding to one in which: (i) the set ofweightless binary thermometer code tuples is assembled into a matrixwith said weightless binary tuples stacked in a given direction (e.g.vertically) to define a set of orthogonal tuples (c1 to c6) eachextending in said given direction (e.g. vertically) and each made up ofa bit taken from each of said weightless binary tuples at a respectivebit position, and (ii) each of said orthogonal tuples (c1 to c6) issubjected to a thermocoding step to group the set bits at a given end ofeach tuple, thereby to order the Hamming values of said weightlessbinary thermometer code tuples.
 18. Apparatus for treating an input setof weightless binary tuples, which comprises: first stage thermocodeconverter means (12) for converting each of said weightless binarytuples into a weightless binary thermometer code tuple to provide a setthereof, and transformation means (14) for performing an orthogonalthermocoding operation corresponding to one in which: (i) the set ofweightless binary thermometer code tuples is assembled into a matrixwith said weightless binary tuples stacked in a given direction (e.g.vertically) to define a set of orthogonal tuples each extending in saidgiven direction (e.g. vertically) and each made up of a bit taken fromeach of said weightless binary tuples at a respective given bitposition, and (ii) each of said orthogonal tuples is subjected to athermocoding step to group the set bits at a given end of each tuple,thereby to order the Hamming values of said weightless binarythermometer code tuples.
 19. Apparatus according to claim 18, whereinsaid first stage thermometer code converter means (12) comprisesrespective thermometer code converter means (12) for each of saidweightless binary tuples making up the input set.
 20. Apparatusaccording to claim 17, wherein said transformation means includesorthogonal tuple defining means for defining a set of orthogonal tuples(c1 to c6), each said orthogonal tuple being made up of bits taken froma respective bit position of said weightless binary thermometer codetuples, and respective thermometer coding means (14) for thermocodingeach of said orthogonal tuples.
 21. Apparatus according to claim 20,including means for analysing a matrix made up of said thermocodedorthogonal tuples to determine the or a central tuple (16) orthogonal tosaid orthogonal tuples, said central tuple (16) representing to themedian Hamming value of said weightless binary thermometer code tuples.22. Apparatus according to claim 19, including means for analysing amatrix made up of said thermocoded orthogonal tuples to determine atleast one of the first (18) and the last (20) of said orthogonal set oftuples, which represents at least one outlier.
 23. Apparatus accordingto claim 19, wherein at least one of thermometer coding means (12, 14)comprises an asynchronous thermometer coding means (22) using a modularstructure (26).
 24. Apparatus according to claim 19, wherein at leastone of the thermometer coding means (14) comprises a pipelinedsynchronous thermometer coding means.
 25. Apparatus for treating aninput set of weightless binary thermometer code tuples (t1 to t5) eachwith the set bits grouped at a given end of the tuple, said apparatuscomprising: respective thermometer code converter means (14) for eachbit position of the input tuples, each thermometer coding means (14)receiving a bit from each of the weightless binary thermometer codetuples and performing a thermometer coding operation on said bits,collectively to apply an orthogonal coding operation on said weightlessbinary tuple code tuples, to provide a set of orthogonally thermocodedtuples (c1 to c6), which when assembled side-by-side in a matrix makeup, an ordered set of tuples representing the Hamming value of saidweightless binary thermometer code tuples.
 26. Apparatus for treating aninput set of weightless binary tuples (t1 to t5) which comprises:—respective first stage thermometer code converter means (12) forconverting each of said weightless binary tuples (t1 to t5) into aweightless binary thermometer code tuple; respective second stagethermometer code converter means (14) for each bit position of the inputtuples, each thermometer coding means receiving a bit from each of theweightless binary thermometer code tuples and performing a thermometercoding operation on said bits, collectively to apply an orthogonalcoding operation on said weightless binary tuple code tuples, to providea set of orthogonally thermocoded tuples (c1 to c6), which, whenassembled in a matrix, make up in the direction orthogonal to saidorthogonally thermocoded tuples (c1 to c6), an ordered set of tuplesrepresenting the Hamming value of said input weightless binarythermometer code tuples (t1 to t5).
 27. Apparatus according to claim 17,which includes bit pattern comparison means for comparing the bitpattern, after said orthogonal thermocoding step, of at least one ofsaid tuples corresponding to a given Hamming value ranking, with each ofthe bit patterns of the tuples before said orthogonal thermocodingoperation to determine an equivalent thereto, and pattern selectionmeans responsive to said bit pattern comparison means to output a tuplehaving a bit pattern identical to that of the input tuple with saidgiven Hamming value ranking.
 28. Apparatus according to claim 25,wherein said bit pattern comparison means comprises respective logicmodules (49′, 49″, 49′″) each for comparing the bit pattern of a givensingle tuple (VHT1, VHT2 or VHT3) resulting from said orthogonal codingstep with a respective one of the tuples input to said orthogonalthermocoding step (HT1, HT2 and HT3).
 29. Apparatus according to claim26, wherein said apparatus further includes respective logic modules(49′, 49″, 49′″) each for comparing the bit patterns of the remainingtuples (VHT1, VHT2, VHT3) resulting from said orthogonal coding stepwith the tuples input to said orthogonal thermocoding step (HT1, HT2,HT3).
 30. A filter for filtering a stream of weightless binary tuplescomprising input means (32) for selecting from an input stream ofweightless tuples a predetermined plurality of sample tuples and forsupplying said sample tuples to apparatus (36) according to claim 15 toorder the Hamming values of said weightless tuples, and selection means(36) for selecting at least one of said Hamming values according to itsorder and for outputting said selected Hamming value as the filteredoutput.
 31. A filter according to claim 30, wherein said input meanscomprises a plurality of sample holding registers (32) arranged inseries and clock means (34) for clocking said stream of weightlesstuples through said registers (32).
 32. A filter according to claim 30,wherein said selection means (36) selects a Hamming value having amedian Hamming value for the filtered output.
 33. A filter according toclaim 30, for filtering data representing a two dimensional image,wherein said selection means comprises a plurality of sample holdingregisters (32), line delay means and clock means for defining a rollingfilter window.